<?php 

// echo $this->js->ajax("ok","/mvc/blog/create");
$this->layout = '~/views/shared/_defaultLayout.php';
?>
<script type="text/javascript">
	$(document).ready(function() {
    var max_fields      = 10; //maximum input boxes allowed
    var wrapper         = $(".input_fields_wrap"); //Fields wrapper
    var add_button      = $(".add_field_button"); //Add button ID
   
    var x = 1; //initlal text box count
    $(add_button).click(function(e){ //on add input button click
        e.preventDefault();
        if(x < max_fields){ //max input box allowed
            x++; //text box increment
            $(add_button).before('<div class="heelo"><input type="text" class="form-control form1" name="mytext[]"placeholder="Add Subject Name/code" /><a href="#" class="remove_field">Remove</a></div>'); //add input box
        }
    });
   
    $(wrapper).on("click",".remove_field", function(e){ //user click on remove text
        e.preventDefault(); $(this).parent('div').remove(); x--;
    })
});
</script>
<div class="block bgWhite">
	<div class="content"><div id='bloglist'></div></div>
</div>

<div class="block bgWhite">
	<div class="content">
		<img src="http://catalizt.com/wp-content/uploads/2013/07/blog-banner.jpg" width="990" alt="" />
	</div>
	<div class="content">
	<div class="row header_row">
  <div class="col-xs-6 col-md-4 interest"><h2>Interest</h2></div>
  <div class="col-xs-6 col-md-4">
    <div class="radio radio_row">
          <label><input type="radio" name="optradio">Learn</label>
        </div>
        <div class="col-xs-6 col-md-4">
        <div class="radio radio_row">
          <label><input type="radio" name="optradio">Teach</label>
        </div>
        </div>
    
</div>
</div>		
<div class="row">
<?php 
					
					$unserialize_meta=unserialize($masters['meta_value']);
					 // echo "<pre>";print_r($unserialize_meta);echo "</pre>";
                    foreach($err as $error){
                        echo $error;
                    } 
                ?>
 				<form action="" method="post">
 				<div class="col-xs-6 col-md-4">Masters</div>
  			<div class="col-xs-6 col-md-4">
			<input type="text" class="form-control" placeholder="Add Course Name" name="course_name" id="course_name" value="<?php echo (isset($unserialize_meta['course_name'])) ? $unserialize_meta['course_name']:null ?>" />
			<?php echo $err['course_name']; ?>	
			<?php for($i=0;$i < 2;$i++){ ?>
			<div class="checkbox">
			      <label>
			        <input type="radio" name="year"> <?php echo $getyears[$i]['year']; ?>
			        <?php echo $err['year']; ?>	
			      </label>
    			</div>
    			<?php } ?>
    			<?php for($i=0;$i < 4;$i++){ 
    				?>
    			<div class="checkbox">
			      <label>
			        <input type="radio" name="sem_name"><?php echo $getsemesters[$i]['sem_name']; ?>
			        <?php echo $err['sem_name']; ?>	
			      </label>
    			</div>
    			<?php } ?>
				</div>
		<div class="col-xs-6 col-md-4">
	  		<div class="input_fields_wrap">

	  			<?php
	  			
					if (is_array($unserialize_meta)) {
						
						foreach ($unserialize_meta['mytext'] as $key => $value) {
								echo "<div><input type='text' class='form-control form1' name='mytext[]' value='".$value."'></div>";
								<?php echo $err['mytext']; ?>	
						}	

						$size = sizeof($unserialize_meta['mytext']);
						if($size > 0){
							$num = 5 - $size;
							for($i=1;$i <= $num;$i++){
								echo "<div><input type='text' name='mytext[]' class='form-control form1' value=''></div>";	
							}
						}	
					}else{ ?>
						<div><input type="text" name="mytext[]" class="form-control form1" placeholder="Add Subject Name/code" id="mytext" value="" />
						<?php echo $err['mytext']; ?>	
			    		</div>
			    		<div><input type="text" name="mytext[]" class="form-control form1" placeholder="Add Subject Name/code" id="mytext" value="" />
			    		<?php echo $err['mytext']; ?>
			    		</div>
			    		<div><input type="text" name="mytext[]" class="form-control form1" placeholder="Add Subject Name/code" id="mytext"  value="" />
			    		<?php echo $err['mytext']; ?>
			    		</div>
			    		<div><input type="text" name="mytext[]" class="form-control form1" placeholder="Add Subject Name/code" id="mytext"  value="" />
			    		<?php echo $err['mytext']; ?>
			    		</div>
					<?php } ?>

					<button class="add_field_button btn btn-primary">Add Fields</button>
			</div>
		</div>
  			<input type="hidden" name="user_id" value="1" />
			        <input type="hidden" name="meta_key" value="meta_key" />
			        <input type="hidden" name="id" value="<?php echo (isset($masters['id'])) ? $masters['id']:null ?>" />
                        <div class="col-xs-12 col-md-6">
                            <input type="submit" name="usersubmit" class="btn btn-primary" value="Save"  />
                        </div>
                    </form>
		</div>	
			

</div>
</div>
